<?php
	require_once 'CheckoutView.php';
	class CheckoutManager{
	
		public function validate($param1){
		
				if(is_numeric($param1)){
					return true;
				}else{
					return false;
				}
		}

		public function deleteResident($param1){

			$conn = oci_connect("naiad", "1234", "localhost/XE");
			$a = oci_parse($conn, "DELETE FROM STUDENT WHERE STUDENTNO LIKE '".$param1."'");
			if(oci_execute($a)){
			return 1;
			}else{ return 0; }
			
			oci_commit($conn);
			oci_close($conn);

		}
		
		public function updateCheckin($param1){
			$date = date("F j,Y");
			$conn = oci_connect("naiad", "1234", "localhost/XE");
			$b = oci_parse($conn, "UPDATE CHECK_IN SET DATE_OUT='".$date."' WHERE DATE_OUT='currentResident' AND STUDENTNO='".$param1."'");
			$c = oci_parse($conn, "UPDATE KEYDEPOSIT SET DATERETURNED='".$date."' WHERE DATERETURNED='currentResident' AND STUDENTNO='".$param1."'");
			if(oci_execute($b)&&oci_execute($c)){
			return 1;
			}else{ return 0; }
			oci_commit($conn);
			oci_close($conn);

		}
	
	}
?>
			